Skip to content

[fix] Declare agent-sandbox proxy Service port as TCP for service-mesh compatibility - #367

Open
oliverclyde wants to merge 2 commits into
mainfrom
fix/agent-sandbox-proxy-tcp-port
Open

[fix] Declare agent-sandbox proxy Service port as TCP for service-mesh compatibility#367
oliverclyde wants to merge 2 commits into
mainfrom
fix/agent-sandbox-proxy-tcp-port

Conversation

@oliverclyde

Copy link
Copy Markdown
Contributor

Problem

On clusters with a service mesh (verified: Istio with namespace-wide sidecar injection), R²/App Builder fails completely and silently: git clones from sandboxes return 404 "repository not found", sessions die ~5s after WebSocket connect, and the agent-sandbox-proxy log shows zero forwarded requests.

Root cause: sandboxes reach the agent-sandbox-proxy (port 3019) using forward-proxy semantics — absolute-form request lines (GET http://host/path HTTP/1.1) and CONNECT tunnels. The proxy dispatches on exactly that shape (agent_executor/proxy/src/handlers.tsreq.url.startsWith('http://')). The Service declares the port as name: http, which mesh protocol selection reads as an instruction to L7-parse traffic on that port. Envoy's re-serialization normalizes absolute-form to origin-form + Host header, so the proxy no longer recognizes the request as proxy traffic, falls through to its Express routes, and returns Express's default 404 — with no log line on any Retool component.

Fix

Declare the port tcp-proxy. Mesh sidecars then handle 3019 as an opaque TCP stream: request bytes survive verbatim, and the hop stays fully in-mesh (sidecars on path, auto-mTLS intact). No exclusion annotations, no DestinationRules, no plaintext holes.

The headless *-agent-sandbox-pods Service keeps name: http deliberately — it carries ordinary origin-form HTTP/WebSocket, which meshes handle correctly.

Field validation (customer AKS cluster, Istio, injection enabled everywhere, case 00121616)

configuration control plane → proxy sandbox → proxy
stock chart (name: http) 401 (works) broken, git 404, proxy log silent
excludeOutboundPorts annotation only works broken identically
both exclude annotations 503 (auto-mTLS vs excluded inbound port) never reached
both annotations + port-level tls.mode: DISABLE DestinationRule works works (plaintext, bypasses sidecars)
this change only (Service patched to tcp-proxy, no annotations/DR) works, over sidecar mTLS works: ~1000 proxied requests (991×200/8×201), 12 WS connections, npm + full snapshot lifecycle, zero errors

Non-mesh clusters are unaffected: vanilla Kubernetes treats Service port names as labels; the Service's targetPort: http still refers to the (unchanged) container port name.

🤖 Generated with Claude Code

…h compatibility

Sandboxes reach the agent-sandbox proxy with forward-proxy (absolute-form)
requests and CONNECT tunnels on port 3019. Naming the Service port "http"
opts it into mesh L7 handling (Istio protocol selection), and Envoy's
re-serialization rewrites absolute-form request targets to origin-form,
so the proxy no longer recognizes them and 404s silently. Declaring the
port tcp-proxy keeps sidecars in TCP passthrough: bytes survive verbatim,
the hop stays in-mesh with auto-mTLS, and no exclusion annotations or
DestinationRules are needed.

Field-validated on a customer AKS cluster with namespace-wide Istio
injection (case 00121616).

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
@greptile-apps

greptile-apps Bot commented Sep 1, 2026

Copy link
Copy Markdown
Contributor

Confidence Score: 5/5

The PR appears safe to merge, with no concrete blocking or non-blocking defects identified.

The focused Service port-name change preserves Kubernetes routing while preventing service meshes from applying the HTTP request transformations that break forward-proxy and CONNECT traffic.

Important Files Changed

Filename Overview
charts/retool/templates/deployment_agent_sandbox.yaml Changes only the agent-sandbox forward-proxy Service’s protocol-signaling port name; the port number, TCP protocol, target port, selectors, and numeric Ingress backend reference remain aligned.
charts/retool/Chart.yaml Applies the expected patch-level chart version increment for the template fix.

Reviews (1): Last reviewed commit: "[fix] Declare agent-sandbox proxy Servic..." | Re-trigger Greptile

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant